package com.example.vueserver.vueserver.dao;

import com.example.vueserver.vueserver.bean.SysRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SysRoleMapper {
    @Select("SELECT * FROM sys_role WHERE id = #{id}")
    SysRole selectById(Integer id);
    @Select("SELECT * FROM sys_role WHERE name = #{roleName}")
    SysRole selectByName(String roleName);

   @Select("select a.* from sys_role a,sys_user_role b where b.role_id=a.id and b.user_id=#{userId}")
    List<SysRole> listUserRoles(Integer userId);

   @Select("select * from sys_role")
    List<SysRole> listAll();
}

